public class TestDemo3 {
    public static int sum1(int n){
        if(n<10){
            return n%10;
        }
        return sum1(n/10)+n%10;
    }
    public static int sum(int n){
        if(n==1){
            return 1;
        }
        return sum(n-1)+n;
    }
    public static void main(String[] args) {
        System.out.println(sum(5));
    }
}
